updated as per wkeese, adrian ans cjolif's comments