Tidying up and fully implementing the db stuff in c#