Code cleanup.

Cleaned up tabs, moved argument validation to its own method.