added Achal's code, and improved main activity