lots of refactoring. now requires python3.x, which breaks gui for now.