Added some tests, filled out comments, fixed a potential bug in Dial