Added support for autolayout and refactored internal code.

Just creating a pull request on our end for this.
Kill this because this won't be used in a nib.