API and cleaned things up a bit
Merge pull request #18 from winnietong/api

API and cleaned things up a bit