Refactor private variables and implement function to print the result.