added tag support, minor changes