Refactor GUI into components