Worked out some bugs, I think