refactor some methods