lots of cleanup of apiv1.py and stuff (i think it should be a bit faster now...)