visibles and created a validation function to decide which function to run based on the type of file