added join database stuff