refactor to new entry point

first hack at #36