Removed unused inspect() function, added documentation, and small refactoring