reorganized API,
#392