cleaner implementation of data functions