A piece of advice: You really ought to try to be consistent with your notation, specifically with the subscripts. m1g is not the same as mg1. The first implies more than one mass with a fixed value for g. The second implies a single mass with multiple values for g. While it is possible to realize that you mean the first when you write the second, such looseness has a much higher chance of leading to mistakes or miscalculations (which are even harder to find when the notation is inconsistent).
As to your derivation, I find it logical and relatively easy to follow (ignoring the notation inconsistencies). In essence, you have defined equations for all elements of your system and then merged them into a single equation representing the entire system. This basic approach is very repeatable, so it's a good approach to know. Other approaches may be faster in some cases, but they often rely on a little more intuition (e.g., knowing how to quickly determine the net force as you did in ID:33530299) and/or are not generally applicable to all systems (e.g., consider if there were 3 or more masses or if the inclined plane was not a straight line or if the system was initially in motion).