I found a few syntax errors with your code, so I went ahead and hacked out some fixes