Simplify the code a bit by creating the functions: