Sort by added in front end + refactoring