made write protocol easily configureable (No more magic numbers)