ticket #8: added trimming support