Lots of refactoring / updates