#5 implemented, product function changed
#6 implemented