renamed, eliminated non-main code, takes args