added input verification