Fixes #25 by making cleanup Java's responsibility (not sure why we didn't do that in the first place). Also working on #17.