Use an enum instead of strings for filetytpes
Move optimize to the Utils class
Formatting fixes