Refactored SDK and demo app to use SDK