Corrected some problems with the code in the view