more api work done but its still a mess