added clean function, bugfixes

clean function should allow user to clean
all previous states of source packages.
fixed bug where parameters have not been assigned
correctly when calling subfunctions