Enhance stc.py logic