updating code with code that actually works