Copied the latest test to the real app location.
Factored out some classes so that the main code is readable.
Remove unused includes.