new realization, added answer about complextity