#16 - some optimizations