Got the basic select and update working. General tidying up.