Added documenting comments and some whitespaces in code.