Added deferring function for js