uncommented some code found to be necessary