Fix, refactor, test