logic reoganization for lcabnd.f