add support for handling labels, closes #12