major refactor back to basics