database work done still need joins for output