improved comments a little
code cleanup
added API documentation
added deallocator