Relocated functions to minelib, renamed functions with unit prefixes, altered source file system structure, added event handling