utils; make more functions inline to avoid stack