Implement onclick for buttons
Refactor view factory