Refactors suggested by @HugoGiraudel