Fixed 2 bugs
Implemented factors