Item flag expansion

These two commits allow for more than 32 item flag values, by switching to unsigned long long.

I have no idea if I'm doing this the right way though.