Finish function of sorting by column. Separate admin and user pages