tightened code, cleanup