fixed issue with buttonclicks and multiple views
codeoptimization
made methods part of class
several intermediate changes