added documentation and some changes to the unity part