refactored the refuctoring