code clean up

still needs a bunch of work... it's a mess