More cleanups to logic()