updated script for linnumber calc