Implemented mtoman's comments.