used the version without stack problems