Big api cleanups and pulling in maxime's UI work.

Review by @Warry and @retroryan