Refactor & config file update & tests