Rework entry-point function so it works in dev and standalone