Hopefully fix some scoping issues