Formatted code
Added scroll changed listener