First round of modifications. Code is producing correct results