Basic tests and small improvements for trim