refactor js functions inside projects page