for-loop implemented by Pucong:)