Add more intelligent bd function