Changed code organization