Ah, this function is a bit long so it doesn't fit all in one view of my browser.