better argument handling in javascript