Refactored the listing codes