Refactoring parameters and main class