add rows and columns functions to API
fix doc
tidy up implementations