Reduced some boilerplate code
Added stored_file ids to the names of stored files to guarantee uniqueness