implemented extraction and getting max from patches