modified .js for new requirements