Added Matts Modified main code