Refactoring on the getX functions