First stage of fixing up of code...Just fixing the brackets and other things...more