Major refactoring 070714