added tags support and tweaked