added if statment and logical