update lattice api and move print to main