Refactor, removing redudndant code