clean up code, add sorting on tables, complete admin