Created local main + more refactoring