Basic working code after major refactor (not 1-1)