Added -Wall and implemented suggestions