added check for missing parameters to most functions.