Updated program

hopefully will work better