Reorders function to follow index.html. Adds checks for all categories.