hash map replaced with if conditions