Polished my function