more code for associations and refactoring