Code style improvements and fixing #16