adding documentation for all functions and fixing indentation issues