fixed a thread problem with javafx, but meh, the code is now a mess... forward reference restrictions from hell :/