Needs to be merged with upstream