Added cflags for buildfile and cleaned code a bit