Some more refactoring. Still a lot of duplication and gonna correct that later.