added fxml and some refactoring