added comments and corrected left and right