Modified to support CocoonJS