Added hash mapping instead of if statements