Refactored sidenotes js