First batch of changes for ApplicationSample

Not quite working yet, but alsmost