More correct javascript