Updated macro by J. Belikov