Fixed pedantic warnings and some comments