sm501: Fixed code style and a few typos in comments