Refined trim functions