Forgot an end statement. While I was at it, added some more comments.