added function docs
coding style fixes