corrected some bad written code parts