added functions from stefan