implementing sorting, adding db export