add separate tags to output
adapt error checking