first stab at api for legacy support. Working but not passing tests