Update to database; Adding sort