Fixing Errors (FINISHED)

woohoo! logic errors are fixed. coding convention violations are not
though :(