seprating logic into a class