added wrap funct but is not working correctly