Clean up logic around hashes/shorturls by adding heuristic