Added implementation of additon and product as a single function