some refactors
whopped off a whole bunch of it. haven't tested it, but it's ready to test