back on the horse. refactored a lot.