Updated pixel-sorting JS