refactoring some methods