putting everything into jquery functions instead of services