Basic refactor complete, fully working again.