make sure it doesn\'t die on IE when the dev. tools are not open
move server-related code into  folder
fix deprecations and clean up a bit