Standards and architecture tweaks.

Coding standards fix, and casting inputs to public methods to prevent possible type errors.