Add tests for trim utility/fix a few bugs