added solver code