Code cleanup
Removed autopublish, moved client main code