reformated code into new style