move api stuff into its own file
fix bug in models.py
Merge pull request #10 from pmrowla/master

improve api querying