Start of split into platform dependent code and testable code

I started some work on splitting up the code as we discussed earlier. Consider the code so far as just an introductory example to what I was talking about.

If you want I can continue moving stuff into the current split code or I can assist you in the same work, or you can just use it as an example and ignore it ;)