Move cake's build callback to a separate function