utility functions by waki.