Minor refactoring to use enums instead of raw numbers
Fixed #30 for good. Issue was still present because we ran into buffer size exceptions