Added extensive JavaDoc to MainActivity