lotsa stuff & refactoring & generalizing & shit