combine with zim, this code is dirty and please refactor it later