Updating Data class with better checks, adding unit test for Data class