fixed code organization