Small refactorings to improve readability. Added few comments.