Improve code, change with 'unless'