fixed percentage bugs, added test code