A bunch of restructuring for new and proper layout