add view code and called the main method