Adapted controller to handle connection logic
Minor change to state name
Merge pull request #13 from ptony82/features/handle_connection

Adapted controller to handle connection logic