-added the rest of the code that makes it actually work