fixing reference and returning all data