added add routine and fixed variable names