refactor some complex methods