UMD, improve coding style and bug fixes