some documentation and code beautifying...