Unexposed api

Also fixed a small bug.