Further separated framework code from the sample app. Renamed class for improved clarity. Deleted redundant code. Added some comments.