updated code that actually works