cos function added