Added logging, cleaned up the list function