Updated code to work in 1.6.4!