Added wrap function to function.js