Major refactor - continued