added if statment handling