Feature/resource cleanup

This PR fixes #18.
Yeah, that'll be more futureproof, I'll change it to that.