Fixed error and formatted code