Fix bugs; add new methods