Refactored render code.

Also Added options Index
Cleanup to prepare for Y