Some refactoring and add check that filters file exists

You cannot read a document that does not exist