Refactored UI into new class