Added all necessary functions for JS code gen