refactored url shortening