tried wrapping code in doc ready function, broke it