added helper functions to MainActivity