First working decode function.
Buffer checks.
Add bytes param to decode.