Code updated according to coding guidelines