Refactoring added more functionaly