Removed dead code, fixed typo and changed function modifier.