Phase five

not yet refactored, but works