Added pause menu and refactoring