Swap to using bitflags instead of ints for flags