Cleaned up js generation