made it pure function