change @license to Apache v2; misc. code cleanup