* added comments and ajusted code.