Refactored prep_calcArrayMode.rb again