cleanup

Huge part of the cleanup is done now, including the remake of local
variables