Refactor according to suggestions filipe suggestions