Updated types and query stuff.
Added application api.