Dev cleanup

Cleanups of all the *demo* branches + some fixes for Linux build. After merging it we can wipe out the *demo* branches. 

This is only cleanup, the bug of loosing network after Agent start still tends to pop up.