Replaced with fork by Rowan Beentje to fix numerous issues