changing type from strings to bytearrays and refactoring code to match