refactored for future MAL support, added config file support