added switchable functionality to separate branch