Oh man I this was some of the first python code I ever wrote and it totally shows. having a test mode is totally brain dead and should be removed from the code.