Code cleanup

- Code refactoring and cleanup.
- Constants moved to TodosConstants class.
- Javadoc comments.
- Several possible NullPointerExceptions fixed.