Added ray emission code