added trim and other small updates