Fixed auto reload and added functions that run on page load