Removed statics, cleaned up some code