First major refactor complete

The first major refactor of the code base is complete and merged to dev and dev to main. Details to follow but this should substantially aid in my ability to add new functionality, tests and avoid breaking existing code.