refactored the code to be reusable