Implements a more modularized and testable code