modified database/imd.. needs work, doesn't cmpile now