Fix to #862
Randomised Powerup formula
Fix for #861
fixed declare residency bugs
more residency fixes