Refactor into a more ood like design