replace case statement with dictionary hash