First set of refactoring from video.