This is outdated and a duplicate function. The actual function is below (line 495), so please remove this.