Updated commented documentation and fixed minor API issues