Refactored layouts

Fixed some layout issues and added better compatibility