cleaning up and api improvement