Added fps display, cleaned up the code and documented the essential steps