a little more cleanup and bug fixin