made more stuff resources and loadable. needs a good cleaning though
code that doesn't need to be in a header should be moved