replaced cycles to es5 methods