more logic, more loops