Added if for handling target to scroll to