moved UI and file writting out of playlist