Added ex2. Heads-up: unoptimized, possible memleaks and unreleased blocks.