added sorting and searching functions and login/logout