tried to optimize, finished