Refactored sinkhistory.py