Better use of Arrays and Objects