Updated code by adding class kiosi and optimized code