Corrected various coding problems
Fixed various coding problems