simplifying lm code