removed some unused stuff, refactored etc