cleaning code, adding comments