refactored to better use the dijit lifecycle