Added associations; fixed some errors