Fix flags - they should be unsigned integers not signed. Can now actually store all the neccessary info.