refactoring and expanding

using ddply for some manipulation.
Checking other classes as well