Update sorted_data.py

defined functions to execute separate operations, created interface function