Added scaling + fixed loop range