a lot of cleanup. the author of this file is a pig