added trim() method to trajectory