Implemented changes suggested by Diaoul