Updated

Reduced the use of a global array. Thanks to Y_Less.