Added sorting and filtering to tree and gallery views