major code refactoring

added new file listener functionality