Added runserver, testserver, auto hook on the normal lifecycle. General refactoring