added upgrades, fixed bug with allocation