added saving code to LHS