added example directory. fixed small bugs to get examples work. did not check for correctness