Imrpoved code and documentation