Refactor finished and working!