Added API and hooked it up

BIG CHANGES but it works