refactor stuff into lib

Created by  Tomáš Zemanovič  on May 17, 2025
XSZZB47UXR6KGYFZZQFQR63X2LDKOH6TPNNBRRGHUCI5JJ4JIWVAC
Change contents