Banged out most of the code, bit more work needed