Implemented a working form of thread bounds for a loop