Start of the work on layouts
Removed useless stuff
Improved layout logic