added isset() and changed variable names to be more descriptive