fixed scaler code, indexing issues; answers are close