Refactored

Added new function