moved remaining functions inline