moved funciton def