refactor validate function
refactor line variable name
throw error for invalid object names