changed structure of code