Added file type verification, and better slug function