solution with a hash