refactoring for proper usage