changes to lucas function and formatting