major refactor commencing