Extract common stuff into before.