Struggling to get this version working, so probably best to forget about upgrading the existing code and start from scratch instead.