Bug Fixing of Retrofit Algorithm

Some bug fixes to the retrofit algorithm. Testing was conducted on
simple case studies.