code structure change for different algo choices