Remove some monkeypatches
Move some global methods into the context in which they used
Avoid globals when ivars will do
cc65: fix conflict