Massive refactor, add sample project.
Way too much stuff for one commit!