minor changes.
replaced switches with factories.
fixed some inline TODOs.
refactoring, and going over inline TODO items.