Added conf file and refactored a bit