Customized and trimmed down to for-loop.