Replaced code with original working code from my offline project.