stateful ugly hack. But I like it :)