Fixed dublicates in shortening function.