Modified to accept hashes