Switch BEGIN to sub