fixed some mistakes and cleaned my code