Refactoring library. Created functions