Please try to understand the meaning of the code before making changes in it.
In the above code I have added some code highlights with the following meaning:
Sienna - not necessarely bad as long as you understand your choice. Could be better.
Red - BAD! What were you thinking about? E.g. you cannot install emulator builds (WINSCW) on device.
Lime - OK, but do you know why?