Improved the code organization