Added implementation of Trim