changed to unix newline
added flexible array member
optimized insertion by shifting the whole array to the next empty slot,
instead of bubble sorting.
swapping is no longer necessary, so it is removed.