Updated logic.hs