Adding -Wextra to CFLAGS for further pedantry :)
Some minor refactoring to avoid code duplication.