Refactor simple_linear_example to improve code quality