removed hacky callbacks, added proper event handling (FINALLY)