changed some things around to make for a nicer api