cleaned up stuff to match real API, followed PEP8 better
fewer pointless variables
random clean-up