added comments into complicated methods