Added testes and a more robust image method