Added auto trim support