Merged pull and push finctions into one.

Code improvements.