refactored to use a main class and added inputs