more code fixes, removing unnecessary variables, general cleanup. still untested but believe should resolve some errors.