resize view
refatoring some code