revamp to function behavior. now return useful outputs.