make main method using instance methods in order to improve testability