fixed some bugs
added html output
fixed sum bugs