refactor out superflous conditional because a second key is only possible if the first key is a hash; hence no need if the second key exists