Both versions are now working but performance is horrible.