CLeaned up code; added protos to .h

Fixes #12
Fixes #10
Fixes #1