very oop implementation within c here, i think this will be difficult to map out if taking a procedural / neglecting eventing.