Switch to using enums instead of misterious numbers
Silence some compiler warnings