Added check for enough parameters