Merged MajorCooke's LOS function  additions