Made code nicer by adding interface for data returning