Refactor main methods