modularize; improve naming scheme
change minor behavior for testing