 -- north and will travel towards south to find the required area above it.
 --
 -- the optimal cut line is found via binary search.  
-CREATE OR REPLACE FUNCTION nw_cut(poly geometry, area float, bxmin float, bxmax float, bymin float, bymax float) RETURNS geometry AS $$
+CREATE OR REPLACE FUNCTION hcut_search(poly geometry, updown integer, area float, bxmin float, bxmax float, bymin float, bymax float) RETURNS geometry AS $$
 DECLARE
 -- width of bounding box;
 bwidth    float;

-- 
-- it will return NULL if there was an error and false if
-- a partition was not found.
CREATE OR REPLACE FUNCTION pseudo_parcel(p_uid integer, area float) RETURNS boolean AS $$
DECLARE
-- original polygon
poly       geometry;

    -- (analogous situation for vertical sweep-line).

    -- north-south sweep line (this is a horizontal line that travels in north-south direction)
    cutline := ST_SetSRID(ST_MakeLine(ST_MakePoint(bxmin,bymin), ST_MakePoint(bxmax,bymin)), 900913);
    titer := 0;
    tlow  := 0;
    thigh := bheight;
