Arrays and code cleanup