We should preserve the copyright statements from weight.cc rather than saying "Based on..." (especially as there's a significant amount of code which is reused).