reformated code to own style