moved lp to subroutine
Subroutined many elements

in prep for new simulation phases