added thomas' changes