Some fixes plus addition unit tests added