Marcosvm/testing

A test and some refactoring.