first working code for this project