Tests added and basic documentation with minor fixes