Moved to use of dataset interface and simplified logic