refactored and added layout