Move UI logic to Java and polish UI