Refactor plus some new stuff