use api suggested by @cowboy