split API methods into two separate files, also specs

Should be no functional differences; more modularity would be good, but this is a start.

Fixes #215.