full implementation of API