Format code styles and add tests