Initial development for M500
Minor bug fixes for BB