major refactor/bugfixing/added example