Added foreign keys, cleaned up with rubocop