fixed up main fxn