Refactor + code review fixes.