Updated to work with Craft