added documentation, todo and renamed two functions