UPDATED: New functions added to main.js