Starting of rewritting the logic.