Big refacto, clean code