taking dmvieira's changes