Refactor filelisting