Updated to code that almost maybe works