add shebang and correct input checking