simplifying js function calls