reduced globals, more proper exception handling