Quick and dirty implementation of binary writer