Added sorting functionality and slightly modified animation