useful code for manual solving