third draft after debuging