refactor credit.hs -- hacker school interview