Fixing several issues with new code. Very unstable.