various cleanup to get running under activerecord / rails