JMD

The only issue is that you used variables prior to declaring them.