First version of solution