added relationship and fixed minor issues