Improved snapped layout
Added application state save and restore