Rewrite logic module. Reimplement local abstraction.