Updated to work with new JS object model