Completed documentation and removed debug code