refactored code for health, power, shield components.
removed double code
Fixed error from merging.