Modified the drawLine function to make it more readable.