Refactor method valueFor()