move the +400 out of the innermost loop