Added documentation
Added documentation and renamed functions