Reworked sorting process and integrated internal array php functions using