got it working crappily, but hey, it's java anyway