Updated program and tested