some error handling; add shebang