BRANCH 4.2-DEV: added local mode with some adjustments to api function
to single checkin to accomodate local mode in javascript