moved the resize handler to a seporate function...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>