adding logic to MainActivity