issue #24 code optimization,formatting and remove commented and unused
code from mainactivity