Removed groupRows function and redundant imports