Added comments and logs to MainActivity