Added cancel button (not working).  Reformatted/commented some code to make it more readable.