refactored content getter and moved encoding to prepareContent function