CHanging to a CBV and cleaning up the logic a bit