Copied code from Barney folder.