added some documentation and fixed error with percentage