factorization bug implementation
bug fixed, simplest implementation reached