Add conditional checks before printing ID.

Fixes #9. Adds conditional statements before printing an ID. Remove
concatenation of $attributes[‘id’] since the conditional makes it
unncessary.