Some refactoring + added settings