Refactoring of getStats etc