Implemented changes recommended by @mtripoli