both naive and optimized working, see results