Moved code I had put into a plugin back in