Cleanup code, add showbmt function