Move the tag stuff inside conditional