Self-Consistent Self-Interaction Corrected DFT: The Method and Applications to Extended and Confined Systems