Finished program

I think it works!