Big refactoring

Each instance of every object on stage is now independent of Main. They
are updated by their inner functions and this gives a much clearer code
than before.