refactor in a component, add base64 decoding