made reusable
added explanatory comment