Comments added, code cleaned