Implemented @ebryn and @drogus changes