Port over the code from when I commited to core