Minor: move logic from hamlet to haskell