pooling added, codeis cleaned and bugs are corrected