moved around variables in detector construction