made some functions inline