Bug fixes

Fixed algorithm
updated readme