before clean
greatly modularized gos
cleaned up code