clean up the code

- did some scaffolding
- define the behaviors of each API