Added conditional to check if page just loaded