Code review and clean up