fixed #33 and implemented #32