Updated function for listing accounts