cleaned up some code, figured out that optimisations apparently make it fail on CPU?