Added sorting and toHTML