refactor. thanks tokuhirom