Edited concat and trim to be more general