Added excess comments and fixed possible crash issue