Found the 'proper' version from the official project (the version on their tutorial had many things stripped out!), but it needs updating