Refactor + more input + comain function