removing warnings discovered by using -Weffc++ flag for gcc