Work in progress towards total refactor