Moved lin_solve to new file