code & contract cleanup