removed useless loops