Adjusted byte array method to remove most of magic numbers.