API documentation (for now still subject to change and improve) and cleanup