better comments, remove double code