Refactored all layouts, code rearranged, minor tweaks.