Refactor and added settings