fixed some issues.
Added controller functionality.