Updated code as per project requriement