made last change before submission, added the trim function to newItem to avoid space bug