moved tag creation to model (fixes #24).