Merge from API branch

Re-write of data API to release version 1 and various refactoring/improvements