Changed structure of code