Refactored array setups and added magnetic field.