Removing bad assignment and cleaning up code