final version done. added comments