Replaced case statement with hash of methods