Improve function signatures and documentation