Updates to API handler and minor script fixes