api done, pending minor bugs