added sort files and implemented simple switching