refactored code to keep params out of the model.
File type is set explicitly now.