Analytical optimization of intermediate band systems: Achieving the best of two worlds