solved #9

optimizations