added flann and updated image class
Fixed minor bugs and cleaned up code.