Some refactoring in the code
Starting with the layout
Added some new features for the layout  and some error messages