Some refactoring of methods