added full integration of image pyramids, got rid of globals for precomputed images