Some code cleanup, moved scripts to other files, and web sockets working(?)