Made code much simpler