refactored, cleaned up layout