added file permissions check
added more input types