Code clean up and changes to get locust working in Python 3.