Wrote what I could from memory of previous class. More than likely a bit is missing. Next commit should contain the whole lot