Slight refactor and remove dead code.