• differentiated between projection and detection max indices
• added generic write array function (not sure if I'll keep this or not)