Split out account logic into separate file