changed for being called by js