A working version of the program