JavaFX refactoring