Worked on training loop