Fixed several code review issues