Updating documentation and fixing some unnecessary reference
passing/variable allocation.