Fix style issues, add documentation