Replace branch structure with dictionary lookup