manually cleaning up code

adding documentation for api