Refactor bogo.py. New API.