Factorize code. Added super class for barcode and take photo element.