Improved layout and code structure