Faster version : shifting number rather than swaping and inserting key in one go