Refactor and get rid of broken stringToBytes function