proper documentation and some exception handling implemented