Code Review - Refactor and fixes.