Brought recent changes back into the api refactor branch so work can continue on new api