Moved function call to dom ready