Used a shift() instead of pop(). Fixed #17