now works, but still much memory