Added documentation and fixed indentation