much more cleaned up, ready for some review