Is there any loop hole in that code, if any can you please optimise the code.