add some new stuff, did some refactoring