bad implementation of solver