Refactored old code to be a bit tidier :) Added a sample project