The goal is to both clean up the code through destructuring but also introduce type checking with typescript.