Slight refactoring/tweaking