Refactored some layout and added minor comments.