Fixed function signature and added documentation