revised and fixed v1