Making things more readable and adding tests