Move checking of filename to commandhandler