Compability with server version 1.0.6 or higher, refactoring and code cleanup