refactored master layout