Mostly done with update line function