added edge case for when a key contains spaces