Improvements to naive multiplication algorithm