just polishing code and adding comments