refactored some methods in arrays.js and fixed spaces in other files