minor changes to trial functin