Updated to function locally