Major refactor - more coming!