ArrayIndex works, need to solve the \'Floating point exception\'
Inserting while index < capacity compeltely works