engine split out. clean up public api