imoroved accuracy and fixed bugs